package com.krahets88.stack;

import org.junit.jupiter.api.Test;

import java.util.ArrayList;

public class Question155 {
    @Test
    public void test1(){

    }
}
class MinStack {
     private ArrayList<Integer> list;
     private int min;
    public MinStack() {
        this.list=new ArrayList<>();
        this.min=Integer.MAX_VALUE;
    }

    public void push(int val) {
        list.add(val);
        if(val<min){
            min=val;
        }
    }

    public void pop() {
        list.remove(list.size() - 1);
    }

    public int top() {
        return list.get(list.size()-1);
    }

    public int getMin() {
        return this.min;
    }
}
